/*
* * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.config.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.hera.base.domain.BaseDomain;

/**
 *
 * @author cmontes
 */
@Entity
@Table(name = "BUSINESS_HOUR")
public class BusinessHour extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BusinessHourPK businessHourPK;
    @Column(name = "END_HOUR")
    private String endHour;
    @JoinColumns({
        @JoinColumn(name = "ID_CALENDAR", referencedColumnName = "ID_CALENDAR", insertable = false, updatable = false),
        @JoinColumn(name = "ID_BUSINESS_DAY", referencedColumnName = "ID_BUSINESS_DAY", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private BusinessDay businessDay;

    public BusinessHour() {
    }

    public BusinessHour(BusinessHourPK businessHourPK) {
        this.businessHourPK = businessHourPK;
    }

    public BusinessHour(Long idCalendar, Long idBusinessDay, String startHour) {
        this.businessHourPK = new BusinessHourPK(idCalendar, idBusinessDay, startHour);
    }

    public BusinessHourPK getBusinessHourPK() {
        return businessHourPK;
    }

    public void setBusinessHourPK(BusinessHourPK businessHourPK) {
        this.businessHourPK = businessHourPK;
    }

    public String getEndHour() {
        return endHour;
    }

    public void setEndHour(String endHour) {
        this.endHour = endHour;
    }
    public BusinessDay getBusinessDay() {
        return businessDay;
    }

    public void setBusinessDay(BusinessDay businessDay) {
        this.businessDay = businessDay;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (businessHourPK != null ? businessHourPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof BusinessHour)) {
            return false;
        }
        BusinessHour other = (BusinessHour) object;
        if ((this.businessHourPK == null && other.businessHourPK != null) || (this.businessHourPK != null && !this.businessHourPK.equals(other.businessHourPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.BusinessHour[ businessHourPK=" + businessHourPK + " ]";
    }

    
}
